#include<iostream>

using namespace std;

int main()
{
	int N, M, temp, sum = 0, add = 0;
	cin >> N >> M;
	while (cin >> temp)
	{
		add += temp;
		if (add > M)
		{
			sum++;
			add = temp;
		}
	}
	if (add != 0) sum++;
	cout << sum;
	return 0;
}